home *** CD-ROM | disk | FTP | other *** search
- Path: gidora.kralizec.net.au!root
- From: srsawyer@zeta.org.au (Stephen Sawyer)
- Newsgroups: comp.lang.c++
- Subject: Problems passing Device Context handels from VB 4.0 to VC++2.0 DLLÆs
- Date: Wed, 17 Apr 1996 07:49:27 GMT
- Organization: Kralizec Dialup Internet Sydney, +61-2-837-1183 V.32bis
- Message-ID: <4l2bbd$mto@gidora.kralizec.net.au>
- NNTP-Posting-Host: dialup05.syd1.zeta.org.au
- X-Newsreader: Forte Free Agent 1.0.82
-
- If anyone has has any experiance in writing VC++ DLLs and passing
- Device Context handels from VB 4.0, I would realy appresiate your
- help. I am trying to sent a Device Context handel from VB 4.0 to a
- VC++ 2.0 custom DLL but as you can see from my debugger watch values,
- I do not receive a proper Device Context (hDC) in my VC++ DLL and the
- result is my DLL crashes. However I can call the same DLL from a test
- program in VC++ and it works correctly.
-
- My VB calling procedure declaration is of the form
-
- Declare Function MyPassHDC Lib "MyDll.dll" (ByVal hdc As Long) As
- Integer
-
- and my C++ receiving declaration is
-
- int pascal MyPassHDC(CDC* hDC)
-
- If I pass a picture control to the DLL in the following way
-
- MsgBox (MyPicture.hdc) æDiagnostic check to note the value of
- hdc
- Result = MyPassHDC(MyPicture.hdc) æCall the function in MyDll.dll
-
- I get for example a value of 5190 for MyPicture.hdc in the Message
- Box and the following in the VC++ debugger for the same hDC value in
- the DLL
-
- VC++ debugger result ............
- -hDC = 0x00001446 //( = 5190dec)
- -CObject = {...}
- -__vfptr = 0x00000000 //(invalid??)
- [0] = 0x00c90f9e
- [1] = 0x00700465
- [2] = 0x04950016
- [3] = 0x00700465
- [4] = 0x00700465
- -m_hDC = 0x00000000 //(invalid??)
- unused = 13176734
- -m_hAttribDC = 0x00000000 //(invalid??)
- unused = 13176734
- m_bPrinting = 0 //(invalid??)
-
- Why Do I get values of 0x00000000 for -__vfptr, m_hDC, m_hAttribDC
- ????
-
-
- As you can see below I get proper working values for the hdc of if I
- call the DLL from C++ program
-
- VC++ debugger result ............
- -hDC = 0x00651278
- -CObject = {...}
- -__vfptr = 0x5f8867a8
- [0] = 0x5f871577 CDC::GetRuntimeClass(void)
- [1] = 0x5f87db80 <no type> CDC::`vector deleting destructor'
- [2] = 0x5f85a5f1 CObject::Serialize(&)
- [3] = 0x5f825d0d CDC::AssertValid(void)
- [4] = 0x5f825d2b CDC::Dump(& &)
- -m_hDC = 0x000005f6
- unused = -277897221
- -m_hAttribDC = 0x000005f6
- unused = -277897221
- m_bPrinting = 0
-
- I would very much appreciate and help, information or tips on this
- Thanks in advance
-
- Stephen Sawyer
- srsawyer@zeta.org.au
-
-
-
-